<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page import="com.infodms.dms.common.Constant"%>
<%@ page import="java.util.*"%>
<%@taglib uri="/jstl/cout" prefix="c" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<jsp:include page="${contextPath}/common/jsp_head_new.jsp" />
<title>经销商仓库维护</title>
</head>
<script type="text/javascript">
function txtClr(valueId) {
	document.getElementById(valueId).value = '' ;
}

</script>
<% String contextPath = request.getContextPath();  %>
<body> 
	<div class="navigation"><img src="<%=contextPath%>/img/nav.gif" />&nbsp;当前位置：  整车销售 &gt; 经销商库存管理 &gt; 仓库维护</div>
	<form id="fm" name="fm" method="post">
		<input type="hidden" name="curPage" id="curPage" value="1" />
		<input type="hidden" id="dlrId" name="dlrId" value="" />
		<table class="table_query" border="0">
		<c:if test="${oemFlag == 0}">
		<tr><td colspan="4">
		<pre><strong><font color="red">库房建立格式:

 请各经销商在建立库房时按此标准格式设置,同时认真核对渠道对应的经销商名称。
 1、建立自有库：业务渠道+单位名称+自有库,如多个库房的可以单位名称后再加具体地址或者简称
 例:(重庆)重庆安富自有库
 2、建立代销库：选择代销单位时必须认真核对对应业务渠道，代销库是由车辆财务所属权单位建立即开票单位。
 业务渠道+财务单位简称+代销单位简称+代销库,如多个库房的可以单位名称后再加具体地址或者简称
 例： (河北)重庆安富江津分公司代销库
 注意：同一个业务渠道，同不一单位名称不要重复建多个名字相同的库房。

 经销商系统编码规则：CQ开头的是重庆渠道，HB开头的是河北渠道，NJ开头的是南京渠道，
                   HBA开头的是河北CM10渠道，CQZ开头的是重庆专用车CNG渠道 ，
                   HBZ开头的是河北专用车CNG渠道，NJZ开头的是南京专用车CNG 渠道，HBH开头是昌河渠道

 如因库房设置错误,导致零售数据错乱,影响折让兑现,后果自负。</font></strong>
 </pre>
 </td></tr>
		</c:if>
			<tr>
				<td width="20%" class="tblopt"><div align="right">仓库名称：</div></td>
				<td width="39%" >
      				<input name="warehouseName" type="text" id="warehouseName" class="SearchInput" value="" size="20" />
    			</td>
    			<td width="20%" class="tblopt"><div align="right">仓库类型：</div></td>
				<td width="39%" >
      				<label>
					<script type="text/javascript">
						genSelBoxExp("warehouseType",<%=Constant.DEALER_WAREHOUSE_TYPE%>,"-1",true,"short_sel","onchange='setShow(this.value)'","false",'');
					</script>
				</label>
    			</td>
			</tr>
			<tr>
				<td width="20%" class="tblopt"><div align="right">经销商：</div></td>
				<td width="39%" >
      				<select name="dealer" id="dealer__" onchange="changeFleet(this.value)">
      					<c:forEach var="dealerList_D" items="${dealerList }">
      						<option value="${dealerList_D.DEALER_ID }">${dealerList_D.DEALER_NAME }-${dealerList_D.DEALER_CODE }</option>
      					</c:forEach>
      				</select>
    			</td>
    			<td width="20%" class="tblopt" id="lowDel__"><div align="right">代管经销商：</div></td>
				<td width="39%" >
      				<div id="lowDel__L">
				<input type="hidden"  name="lowID" id="lowID" size="15" value=""/>
				<input type="text"  name="lowDel" id="lowDel" size="15" value="" readonly="readonly" />
				<input name="button2" type="button" class="mini_btn" onclick="showOrgDealer('lowDel', 'lowID', 'false', '', 'true','true');" value="..." />
				<input type="button" class="normal_btn" onclick="txtClr('lowDel');txtClr('lowID');" value="清 空" id="clrBtn" />
				</div>
    			</td>
			</tr>
			<tr>
				<td width="20%" class="tblopt"><div align="right">状态：</div></td>
				<td>
				<label>
					<script type="text/javascript">
						genSelBoxExp("warehouseStatus",<%=Constant.STATUS%>,"-1",true,"short_sel",'',"false",'');
					</script>
				</label>
				</td>
				<td width="20%" class="tblopt"></td>
				<td  width="20%" align="left">
					<input name="button1" type=button class="cssbutton" onClick="__extQuery__(1);" value="查询">
					<input name="button1" type=button class="cssbutton" onClick="addMyStore();" value="新增">
				</td>
			</tr>

		</table>
	<jsp:include page="${contextPath}/queryPage/orderHidden.html" />
	<jsp:include page="${contextPath}/queryPage/pageDiv.html" />
	</form>
<script type="text/javascript">
	var myPage;
	
	var url = "<%=contextPath%>/sales/storageManage/MyStore/getMyStore.json?COMMAND=1";
	
	var title = null;
	
	var columns = [
				{header: "序号", dataIndex: 'NUM', align:'center'},
				{header: "仓库名称", dataIndex: 'WAREHOUSE_NAME', align:'center'},
				{header: "仓库类型", dataIndex: 'WAREHOUSE_TYPE', align:'center',renderer:getItemValue},
				{header: "状态", dataIndex: 'STATUS', align:'center',renderer:getItemValue},
				{header: "备注", dataIndex: 'REMARK', align:'center'},
				{header: "操作", dataIndex: 'CAMPAIGN_ID', align:'center',renderer:myLink}
		      ];

	  //设置超链接
    function myLink(value,meta,record){
    	return String.format("<a href='#' onclick='modifyStore("+record.data.WAREHOUSE_ID+")'>[修改]</a>");
    }
	function showResult(json){
		turnQuery();
	}
	
	function turnQuery() {
		 __extQuery__(1);
		
	}
	function modifyStore(wareHouseID){
		fm.action = '<%=contextPath%>/sales/storageManage/MyStore/modInitMyStore.do?warehouseId='+wareHouseID;
	 	fm.submit();
		}
	function addMyStore(){
		fm.action = '<%=contextPath%>/sales/storageManage/MyStore/addInitMyStore.do';
	 	fm.submit();
	}

	function vehicleInfo(value){
		OpenHtmlWindow('<%=contextPath%>/sales/storageManage/VehicleInfo/vehicleInfoQuery.do?vin='+value,700,500);
	}

	function changeFleet(value) {
		var sLowDelName = "" ;
		var sLowDelId = "" ;
		var i = 0;
		
		<c:forEach var="lowDelList_D" items="${lowDelList }">
			if(${lowDelList_D.PARENT_DEALER_D} == value) {
				sLowDelName =sLowDelName+'${lowDelList_D.DEALER_NAME}' + "," ;
				sLowDelId = sLowDelId + '${lowDelList_D.DEALER_ID}' + "," ;
				i++ ;
			}
		</c:forEach>
		if(i==0) {
			document.fm.lowDel__L.options.length=1;
			document.fm.lowDel__L.options[0].value="" ;
			document.fm.lowDel__L.options[0].text ="-请选择-"
			}
		else {
			document.fm.lowDel__L.options.length=i+1;
			document.fm.lowDel__L.options[0].value="" ;
			document.fm.lowDel__L.options[0].text ="-请选择-"
			for(var j=0; j<i; j++) {
				document.fm.lowDel__L.options[j+1].value=sLowDelId.split(',')[j];
				document.fm.lowDel__L.options[j+1].text=sLowDelName.split(',')[j];
			}
		}
	}

	function setShow(value) {
		var iValue = <%=Constant.DEALER_WAREHOUSE_TYPE_01 %>
		if (value == iValue) {
			document.getElementById("lowDel__").style.display = "none";
			document.getElementById("lowDel__L").style.display = "none";
			}
		else {
			document.getElementById("lowDel__").style.display = "inline";
			document.getElementById("lowDel__L").style.display = "inline" ;
			}
	} 
</script>
</body>
</html>